<template>
	<view class="edit-info">
		<view class="create-project-form">
			<view class="create-item">
				<text class="info-item-title">微信号</text>
				<input class="info-item-input" type="text" placeholder-class="placeholderFontClass"
					placeholder="请输入微信号" v-model="wechartNum">
			</view>

			<view class="create-item">
				<text class="info-item-title">手机号</text>
				<input class="info-item-input" type="text" maxlength="11" placeholder-class="placeholderFontClass"
					placeholder="请输入手机号" v-model="phone">
			</view>

		</view>
		<button class="create-btn" @click.stop.prevent="handleEdit">确认</button>

	</view>
</template>

<script>
	import apiRqs from "@/api/api-request.js";
	export default {
		data() {
			return {
				wechartNum: '',
				phone: '',
				tokenInfo: {},
			}
		},
		onShow() {
			const tokenInfo = uni.getStorageSync("tokenInfo");
			if (tokenInfo) {
				this.tokenInfo = tokenInfo;
			}
		},
		methods: {
			handleEdit() {
				let {
					wechartNum,
					phone,
				} = this;
				getApp().showLoading();
				var that = this;
				let rqs = {
					"tel": phone,
					"realName": realNmae,
				};
				console.log(rqs);
				apiRqs._editPersonInfo(rqs).then((res) => {
					console.log('修改结果', res);
					uni.hideLoading();
					if (res.code == 200) {
						getApp().showToast("修改成功", "success");
						setTimeout(() => {
							uni.navigateBack();
						}, 1500)
					} else {
						getApp().showToast(res.msg);
					}
				}).catch((err) => {
					console.log('err', err);
				})
			},
		},
	}
</script>

<style lang="less">
	page {
		background-color: #f5f5f5;
	}

	.edit-info {
		.create-project-form {
			margin: 20px;

			.create-item {
				display: flex;
				align-items: center;
				width: 100%;
				border-bottom: 1px solid #f5f5f5;
				background-color: #fff;
				padding: 16px 15px;
				box-sizing: border-box;
				position: relative;

				.right-arrow-icon {
					position: absolute;
					right: 10px;
				}

				&:first-child {
					border-top: 1px solid #f5f5f5;
					border-top-left-radius: 4px;
					border-top-right-radius: 4px;
				}

				&:last-child {
					border-bottom-left-radius: 4px;
					border-bottom-right-radius: 4px;
				}

				.info-item-title {
					width: 80px;
					flex: 0 0 80px;
					font-size: 14px;
				}

				.info-item-input {
					flex: 1;
					font-size: 14px;
					text-align: left;
					color: #666666;
				}

				.placeholderFontClass {
					color: #ddd;
				}
			}


		}

		.create-btn {
			margin: 20px;
			border: none;
			background-color: #008aff;
			color: #fff;
			font-size: 15px;
			height: 35pt;
			line-height: 35pt;
			&::after{
				border: none;
			}
			&:active {
				background-color: #0076DB;
			}
		}
	}
</style>
